package com.hzsai.mininote.entity;

/**
 * @author hzsai
 * @date 2020/1/7 14:21
 * @usage:
 */
public enum  SexEnum {

    /**
     * FEMALE: 0
     * MALE  : 1
     * MIDDLE: 2
     * UNKNOWN:3
     */

    FEMALE(0), MALE(1), MIDDLE(2), UNKNOWN(3);

    private int type;
    SexEnum(int type) {
        this.type = type;
    }

    public int getId() {
        return this.type;
    }

    public static SexEnum getEnumById(int id) {

        if (id < 0 || id >= SexEnum.values().length)
            return SexEnum.values()[3];
        return SexEnum.values()[id];
    }
}
